﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>

<head>
    <title>Title</title>
    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="${pageContext.request.contextPath}/static/media/favicon.png">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/icofont/icofont.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/slick-carousel/css/slick.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/slick-carousel/css/slick-theme.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/magnific-popup/css/magnific-popup.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/sal.js/sal.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dependencies/select2/css/select2.min.css" type="text/css">

    <!-- Site Stylesheet -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/app.css">

    <!-- Google Web Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,300;0,400;0,600;0,700;0,800;0,900;1,400&display=swap" rel="stylesheet">
</head>
<body class="sticky-header">
<!--[if lte IE 9]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="${pageContext.request.contextPath}/Directory/https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
<![endif]-->
<a href="#wrapper" data-type="section-switch" class="scrollup">
    <i class="icofont-bubble-up"></i>
</a>
<!-- Preloader Start Here -->
<div id="preloader"></div>
<!-- Preloader End Here -->
<div id="wrapper" class="wrapper overflow-hidden">

    <!--=====================================-->
    <!--=          Header Menu Start       	=-->
    <!--=====================================-->
    <div class="login-page-wrap">
        <div class="content-wrap">
            <div class="login-content">
                <div class="item-logo">
                    <a href="${pageContext.request.contextPath}/Directory/#"><img src="${pageContext.request.contextPath}/static/media/logo_large.png" alt="logo"></a>
                </div>
                <div class="login-form-wrap">
                    <ul class="nav nav-tabs" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" data-toggle="tab" href="#login-tab" role="tab" aria-selected="true"><i class="icofont-users-alt-4"></i> Login </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" data-toggle="tab" href="#registration-tab" role="tab" aria-selected="false"><i class="icofont-download"></i> Register</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane login-tab fade show active" id="login-tab" role="tabpanel">
                            <form action="${pageContext.request.contextPath}/user/login" method="post">
                                <h3 class="item-title">登录 <span>你的帐户</span></h3>


                                <div class="form-group" style="margin-top: 35px">
                                    <input type="text" class="form-control" id="namezhu" name="login-email" placeholder="邮箱">
                                </div>
                                <div class="form-group">
                                    <input type="password" class="form-control" id="pwdzhu" name="login-password" placeholder="密码">
                                </div>
                                <div class="form-group reset-password">
                                    <a href="#">* 重置密码</a>
                                </div>
                                <div class="form-group mb-4">
                                    <div class="form-check">
                                        <input type="checkbox" class="form-check-input" id="validationFormCheck2">
                                        <label class="form-check-label" for="validationFormCheck2">让我保持登录状态</label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <input type="submit" name="login-btn" class="submit-btn" value="登录" onclick="return fk()">
                                </div>

                                <!-- <div class="account-create">
                    		Don't have an account yet? <a href="${pageContext.request.contextPath}/Directory/#registration-tab">Sign Up Now</a>
                    	</div> -->
                            </form>
                        </div>
                        <div class="tab-pane registration-tab fade" id="registration-tab" role="tabpanel">

                            <h3 class="item-title">注册你的帐户</h3>
                            <form action="${pageContext.request.contextPath}/user/insert" method="post">
                                <div class="form-group">
                                    <input type="text" id="fname" name="fname" class="form-control" placeholder="名">
                                </div>
                                <div class="form-group">
                                    <input type="text" id="lname" name="lname" class="form-control" placeholder="手机号">
                                </div>
                                <div class="form-group">
                                    <input type="text" id="yanzheng" name="lname1" class="form-control" placeholder="验证码" style="display: inline;width: 240px;"><input type="button"  onclick="return settime(this)" id="getCode" value="获取验证码"  class="submit-btn" style="width: 110px;"/>
                                </div>
                                <div class="form-group">
                                    <input type="email" id="email" name="email" class="form-control" placeholder="电子邮件">
                                </div>
                                <div class="form-group">
                                    <input type="password" id="password" name="password" class="form-control" placeholder="输入密码">
                                </div>
                                <div class="form-group">
                                    <input type="text" id="uaddress" name="uaddress" class="form-control" placeholder="地址">
                                </div>


                                <div class="form-group">
                                    <select style="width: 350px;height: 35px;border: 0px;border-bottom: 1px solid #eaeaea;color: #818181;appearance:none;-moz-appearance: none;-webkit-appearance: none;" name="gender" data-placeholder="选择性别">
                                        <option value="0">男</option>
                                        <option value="1">女</option>
                                    </select>

                                </div>
                                <input type="text" id="duanxin1" style="display: none">
                                <div class="form-group">
                                    <div class="form-check mb-3">
                                        <input type="checkbox" class="form-check-input" id="validationFormCheck1" checked="checked" >
                                        <label class="form-check-label" for="validationFormCheck1">

                                            我接受  <a href="${pageContext.request.contextPath}/Directory/#">条款和条件</a></label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <input type="submit" name="registration" class="submit-btn" value="完成注册" onclick="return zhufk()">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="map-line">
                <img src="${pageContext.request.contextPath}/static/media/banner/map_line.png" alt="map">
                <ul class="map-marker">
                    <li><img src="${pageContext.request.contextPath}/static/media/banner/marker_1.png" alt="marker"></li>
                    <li><img src="${pageContext.request.contextPath}/static/media/banner/marker_2.png" alt="marker"></li>
                    <li><img src="${pageContext.request.contextPath}/static/media/banner/marker_3.png" alt="marker"></li>
                    <li><img src="${pageContext.request.contextPath}/static/media/banner/marker_4.png" alt="marker"></li>
                </ul>
            </div>
        </div>
    </div>

    <!--=====================================-->
    <!--=      Header Search Start          =-->
    <!--=====================================-->
    <div id="header-search" class="header-search">
        <button type="button" class="close">×</button>
        <form class="header-search-form">
            <input type="search" value="" placeholder="Search here..." />
            <button type="submit" class="search-btn">
                <i class="flaticon-search"></i>
            </button>
        </form>
    </div>
</div>

<!-- Jquery Js -->
<script src="${pageContext.request.contextPath}/static/dependencies/jquery/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/popper.js/js/popper.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/imagesloaded/js/imagesloaded.pkgd.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/isotope-layout/js/isotope.pkgd.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/slick-carousel/js/slick.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/sal.js/sal.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/magnific-popup/js/jquery.magnific-popup.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/bootstrap-validator/js/validator.min.js"></script>
<script src="${pageContext.request.contextPath}/static/dependencies/select2/js/select2.min.js"></script>
<script src="http://www.google.cn/maps/api/js?key=AIzaSyBtmXSwv4YmAKtcZyyad9W7D4AC08z0Rb4"></script>
<script src="${pageContext.request.contextPath}/static/js/jquery-1.12.4.js"></script>
<!-- Site Scripts -->
<script src="${pageContext.request.contextPath}/static/assets/js/app.js"></script>
<script type="text/javascript">
    function fk() {
        var name=$("#namezhu").val();
        var pwd=$("#pwdzhu").val();
        if (name==undefined || name.trim().length==0){
            alert("用户名必填")
            return false;
        }
        if (pwd==undefined || pwd.trim().length==0){
            alert("密码必填")
            return false;
        }
        if (pwd.trim().length<3){
            alert("密码必须大于3位数")
            return false;
        }
        if ( name.trim().length!=11){
            alert("用户名必须是11位")
            return false;
        }
        return true;
    }


function zhufk(){
    var duanxin1=$("#duanxin1").val();
    var fname=$("#fname").val();
    var lname=$("#lname").val();
    var email=$("#email").val();
    var password=$("#password").val();
    var uaddress=$("#uaddress").val();
    var yanzheng=$("#yanzheng").val();
    if (fname==undefined || fname.trim().length==0){
        alert("用户名必填")
        return false;
    }

    if (lname==undefined || lname.trim().length==0){
        alert("手机号必填")
        return false;
    }
    if (password==undefined || password.trim().length==0){
        alert("密码必填")
        return false;
    }
    if (email==undefined || email.trim().length==0){
        alert("邮箱必填")
        return false;
    }
    if (uaddress==undefined || uaddress.trim().length==0){
        alert("地址必填");

        return false;
    }
    if (yanzheng!=duanxin1){
        alert("验证码错误")
        return false;
    }



    if (password.trim().length<3){
        alert("密码必须大于3位数")
        return false;
    }
    if ( lname.trim().length!=11){
        alert("手机号必须是11位")
        return false;
    }
    return true;
}

    var countdown=60;

    function settime(val) {
        var lname=$("#lname").val();
        if(lname!=''  || lname.trim().length!=0 ){
            if (countdown == 0) {
                val.removeAttribute("disabled");
                val.value="获取验证码";
                countdown = 60;
                return flase;
            }
            else {
                if(countdown==57){
      dxyz();
                }
                val.setAttribute("disabled", true);
                val.value="重新发送(" + countdown + ")";
                countdown--;
            }
            setTimeout(function() {
                settime(val)
            },1000)

        }
        else {
            alert("手机号为空");
            return false;
        }
    }


    function dxyz() {

        $.ajax({
            "url":"${pageContext.request.contextPath}/user/duanxin?uphone="+lname.value,
            "Type":"POST",
            "dataType":"JSON",
            "success":function (data) {

               document.getElementById("duanxin1").value=data;
            }
        })
    }
    var staut="${err}"

    if (staut=="1"){alert("密码不对")}
    if (staut=="2"){alert("用户名不对")}


</script>
</body>
</html>
